home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d18 / tpa2_a.arc / README.NEW < prev    next >
Text File  |  1991-04-28  |  7KB  |  158 lines

  1.  
  2.   TP&Asm           Integrated Compile-Time Assembler          Version 2 ß
  3.   TP&Asm-M   Memory Mode Assembly Language Development Tool   Version 2 ß
  4.  
  5.                 Copyright (c) 1989  Richard W. Prescott
  6.                           All Rights Reserved
  7.  
  8. ═══════ Built-In Assembly Language Support for Turbo Pascal Compilers ═══════
  9.  
  10.  
  11.   The following is a brief description of the new features in 
  12. Release 2:
  13.  
  14.   Version 5.0 and v5 TPC are now supported along with Version 4.0 
  15. and v4 TPC.  Version 3 compilers are no longer supported.
  16.  
  17.   With Version 5.0, you can trace (F7 Trace into, F4 Go to cursor, 
  18. etc) your assembly code in the turbo integrated debugger.  The unit
  19. ASMWATCH.TPU, included, defines the record variable CPU which permits 
  20. you to Watch, Evaluate, and Modify the state of all CPU registers and
  21. Flags as you Trace.  Simply include the statement "Uses ASMWATCH;" at
  22. the start of your program.  The following Watch expressions are 
  23. particularly useful:
  24.  
  25.    CPU.CsIp,p       - Segment:Offset of the current instruction
  26.    CPU.CsIp^,m      - Hex Dump beginning at current instruction
  27.    CPU.Flags-On     - Current state of CPU Flags
  28.    CPU.SsSp,P       - Segment:Offset of the Stack Pointer
  29.    W(CPU.SsSp^),$   - Memory Dump at current Stack Pointer
  30.    CPU,$R           - Lists all register names and contents
  31.    CPU.Si,$   (etc) - List contents of any Byte or Word Register 
  32.  
  33.   In addition, MAP files produced with both Version 4.0 and 5.0
  34. compilers contain Line Number detail for all assembly sections
  35. (Except Inline/Assembly DIRECTIVES), permitting source level
  36. debugging in any MAP-file compatible debugger.
  37.  
  38.  
  39.   You can now specify any valid Pascal Label as the target of an 
  40. Assembly Call, Jmp, Loop, or conditional jump.  As with the Pascal
  41. "Goto" statement, the label must be defined in the current block.
  42.  
  43.   You can now specify an assembly label as the target of a Pascal 
  44. "Goto" statement.  The target label must be declared in a standard
  45. Pascal "Label" statement.
  46.  
  47.   The Keyword "Assembly" can now be used in place of "Assemble".
  48. This is useful to avoid misleading constructions like:
  49.       IF <Pascal Condition> THEN Assemble
  50. which gives the false impression of conditional assembly.  True 
  51. conditional assembly is possible as described below.  Conditional
  52. execution of an assembly block is more clearly indicated by:
  53.       IF <Pascal Condition> THEN Assembly
  54.  
  55.   Assembly blocks can now be used in full Pascal conditional 
  56. expressions, eg:
  57.       IF Compiler.Ver = $50 THEN Assembly
  58.         < Assembly language statements >
  59.       END ELSE Assembly
  60.         < Assembly language statements >
  61.       END;
  62. To permit this, the final "End" must now be a valid PASCAL 
  63. statement, eg "END; {Assemble}" rather than "END Assemble;"
  64.  
  65.   There is a new keyword "Asm" for concisely specifying single line
  66. assembly statements, eg:
  67.       Asm Push PascalVar; {Save PascalVar on Stack}
  68. The Asm statement should end with ";" unless there is a subsequent
  69. "ELSE" clause.  The remainder of the line must be blank except that
  70. a comment is permitted after the ";".  The following is valid:
  71.       IF BytePointer^ <> 0 THEN Asm Call PasLabel
  72.       ELSE Asm Inc ZeroCount; {Comment permitted here}
  73.  
  74.   There is a new Assembly Keyword "Pas" for inserting single or
  75. multiple line Pascal statements within an assembly section, eg:
  76.       Pas WRITELN('Compiled with Turbo Pascal Version ',
  77.       Pas {$IFDEF VER40} '4.0' {$ELSE} '5.0' {$ENDIF} );
  78. This permits true conditional assembly by placing a section of
  79. assembly statements between "Pas {$IFDEF ..}" and "Pas {$ENDIF}".
  80.  
  81.   You can now make direct calls to Pascal Procedures and Functions
  82. defined in any standard or user-defined program or Unit.  There
  83. is no longer any need to set up an intermediate variable containing 
  84. the Proc/Function address.  Note however that "System" Procedures
  85. and Functions do not use true PROC Calls and therefore cannot
  86. be called from assembly language, either directly or indirectly.
  87. Use the "Pas" statement, above, to "Call" System Proc/Functions.
  88.  
  89.  
  90.   TP&Asm now performs automatic Jump-Sizing for all backward AND
  91. FORWARD Jumps and Loops (Jmp, jZ, jAE, jCXZ, Loop, LoopNZ, etc).
  92. 3, 5, or 7 byte instruction sequences are automatically generated 
  93. if the target label is not within range of a 2 byte instruction.
  94.  
  95. This includes automatic shortening of unconditional jumps ...
  96.  
  97.     Jmp CloseBy    .. becomes ..    Jmp Short CloseBy ;2 bytes
  98.  
  99. ... automatic 5 byte "IF <Cond> Jmp" for backward AND FORWARD
  100. conditional jumps out of range ...
  101.  
  102.     jNZ FarAway    .. becomes ..        jZ >L0        ;2 bytes
  103.                                         Jmp FarAway   ;3 bytes
  104.                                     L0: 
  105.  
  106. ... and automatic 7 byte instruction sequences for backward AND 
  107. FORWARD jCXZ & Loop's out of range ...
  108.  
  109.     Loop FarAway   .. becomes ..        Loop >L0      ;2 bytes
  110.                                         Jmp Short >L1 ;2 bytes
  111.                                     L0: Jmp FarAway   ;3 bytes
  112.                                     L1:
  113.  
  114. TP&Asm does NOT pad forward jumps with NOP instructions - it
  115. will always build the smallest possible instruction.
  116.  
  117.   (The automatic Jump-Sizing feature is not enabled in Inline/Assembly 
  118. DIRECTIVES.  As described in the Turbo 4.0 and 5.0 manuals, Inline 
  119. Directives are intended for short sections of code which are unlikely 
  120. to exceed 127 bytes.  TP&Asm generates an error if a conditional jump 
  121. out of range is attempted in an Inline/Assembly Directive).
  122.  
  123.  
  124.   There is a new KeyWord "CSDATA" for allocating "Global" CSeg data 
  125. which can be used throughout the current Unit.  Alternately, the FIRST
  126. procedure in a Unit or Program can allocate "LOCAL" CSeg data which
  127. can be used throughout the procedure.  There is no longer any need 
  128. to specify an offset ("Offset-Indexed CSegs").
  129.  
  130.   The construct "SEG Data" is now supported to facilitate restoring
  131. the Turbo Program Data Segment in a user written interrupt procedure:
  132.       Mov Ax,SEG Data
  133.       Mov Ds,Ax
  134.  
  135.   "Register-Indexed CSegs" are no longer supported.  The preceding 
  136. two alternatives make them unnecessary.
  137.  
  138.  
  139.   Your source files will require the following changes:
  140.  
  141.   Make sure that the "End" statement which terminates each assembly 
  142. section is a valid PASCAL Statement.  Thus, "END Assemble;" is no
  143. longer valid - use "END; {Assembly}" (or "END {Assembly}" if there
  144. is a subsequent "ELSE" clause).
  145.  
  146.   "Register-Indexed CSegs" are no longer supported.  Use CsData or
  147. restore the Data Segment with "SEG Data".
  148.  
  149.  
  150.   The archive file TP-TSR contains a set of files which implement 
  151. a sample Stay-Resident application using an interrupt Unit compiled 
  152. with TP&Asm.  The Unit DOS21_0A, in particular, illustrates the use 
  153. of the new CsData Statement.
  154.  
  155.   The file DEMONEW.PAS illustrates a number of the other new features
  156. described above.  Set the Watch Expressions as described and Trace
  157. (F7: Trace into) in the Turbo 5.0 integrated debugger.
  158.